﻿using Cofe.Core.Dynamic;
using Cofe.Core.Property;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Cofe.Core.Interfaces
{
    public interface IEntryConstructor : ICofeService
    {
        /// <summary>
        /// Created property host from primary property provider.
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="primaryPropertyProvider">The contained property provider, which provide properties, 
        /// If null, then it's called by CofeSystemInfo, when it's parameterless constructor is called, which is used by ORM, 
        /// in this case, use cache.</param>
        /// <returns></returns>
        IPropertyHost ConstructPropertyHost(IPropertyProvider primaryPropertyProvider);

        IPropertyHost ConstructPropertyHost();

        
        Task<ICofeSystemInfo> ConstructEntryAsync(IPropertyHost propertyHost);
        Task<T> ConstructEntryAsync<T>(IPropertyHost propertyHost) where T : ICofeSystemInfo;
        Task<ICofeSystemInfo> ConstructEntryAsync(IPropertyHost propertyHost, Type type);
        ICofeSystemInfo ConstructEntry(IPropertyHost propertyHost);
       
        T ConstructEntry<T>(IPropertyHost propertyHost) where T : ICofeSystemInfo;
        ICofeSystemInfo ConstructEntry(IPropertyHost propertyHost, Type type);

        Task<IPropertyProvider> RegenerateEntryPrimaryPP(IPropertyCache cache);

        IEntryPrimaryPPRegenerator[] EntryRegenerators { get; set; }
        ISecondaryPropertyProviderFactory[] SecondaryPropertyProviderFactories { get; set; }
        IPropertyDictionary PropertyDictionary { get; set; }
        IPathParser[] PathParsers { get; set; }
        IDynamicPropertyInterfaceProvider[] InterfaceProviders { get; set; }        
    }
}
